package com.hotel.project.system.roomorders.service;

import com.hotel.common.support.Convert;
import com.hotel.project.system.roomorders.domain.RoomOrders;
import com.hotel.project.system.roomorders.mapper.RoomOrdersMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * 客房订单 服务层实现
 *
 * @author pluto
 * @date 2019-04-06
 */
@Service
public class RoomOrdersServiceImpl implements IRoomOrdersService {
    @Autowired
    private RoomOrdersMapper roomOrdersMapper;

    /**
     * 查询客房订单信息
     *
     * @param id 客房订单ID
     * @return 客房订单信息
     */
    @Override
    public RoomOrders selectRoomOrdersById(Integer id) {
        return roomOrdersMapper.selectRoomOrdersById(id);
    }

    /**
     * 查询客房订单列表
     *
     * @param roomOrders 客房订单信息
     * @return 客房订单集合
     */
    @Override
    public List<RoomOrders> selectRoomOrdersList(RoomOrders roomOrders) {
        return roomOrdersMapper.selectRoomOrdersList(roomOrders);
    }

    /**
     * 新增客房订单
     *
     * @param roomOrders 客房订单信息
     * @return 结果
     */
    @Override
    public int insertRoomOrders(RoomOrders roomOrders) {
        roomOrders.setCreateTime(new Date());
        return roomOrdersMapper.insertRoomOrders(roomOrders);
    }

    /**
     * 修改客房订单
     *
     * @param roomOrders 客房订单信息
     * @return 结果
     */
    @Override
    public int updateRoomOrders(RoomOrders roomOrders) {
        return roomOrdersMapper.updateRoomOrders(roomOrders);
    }

    /**
     * 删除客房订单对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteRoomOrdersByIds(String ids) {
        return roomOrdersMapper.deleteRoomOrdersByIds(Convert.toStrArray(ids));
    }

}
